
var utils = {

    //获取页面指定key值的参数值
    getParamer: function (key) {
        var map = this.getSearch();
        if (map == null) {
            map = {};
        }
        return map[key];
    },
    //获取页面所有key的参数值的集合
    getSearch: function () {
        var search = decodeURIComponent(window.location.search);
        if (search != "") {
            search = search.substring(1);
        } else {
            return null;
        }
        var strsz = search.split("&");
        var map = {};
        $.each(strsz, function (n, strs) {
            if (strs.indexOf("=") != -1) {
                var tempsz = strs.split("=");
                var tempkey = tempsz[0];
                var tempvalue = tempsz[1];
                map[tempkey] = tempvalue;
            }
        });
        return map;
    },

    //获取当前网址的host地址
    getHost: function () {
        var js = "utils.js";
        var scripts = document.getElementsByTagName("script");
        var path = "";
        for (var i = 0, l = scripts.length; i < l; i++) {
            var src = scripts[i].src;
            if (src.indexOf(js) != -1) {
                path = src;
                break;
            }
        }
        var ss = path.split("/");
        ss.length = ss.length - 4;
        path = ss.join("/");
        return path;
    }
}